package com.bwie.mq;

import com.bwie.pojo.po.Customer;
import com.bwie.utils.SendMsgUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.utils.SerializationUtils;

public class EndTimeConsumer implements MessageListener {

    @Override
    public void onMessage(Message message) {
        byte[] body = message.getBody();
        Customer customer = (Customer) SerializationUtils.deserialize(body);

        System.out.println(customer.toString());


        String str = "客户"+customer.getCustomerName()+"已经超过7天未跟进，避免流失，尽快跟客户进行沟通";
        System.out.println(str);
        SendMsgUtil.sendSms(customer.getCustomerPhone(),str);
    }
}
